const formDataTime = (flag = 0) => {

  const dt = new Date()
  let y = dt.getFullYear()
  let m = dt.getMonth() + 1
  // 添加前导0 不满足2位，则添加前导0  padStar=》es6提供
  m = (m + '').padStart(2, '0')
  let d = dt.getDate()
  let h = dt.getHours()
  let minutes = dt.getMinutes()
  let sec = dt.getSeconds()

  if (flag == 0) {
    return `${y}-${m}-${d}`
  } else {
    // 时分秒
    return `${y}-${m}-${d} ${h}:${minutes}:${sec}`
  }
}

module.exports = {
  formDataTime
}